import request from "@/util/request";
import type {Code, LoginParam, AccessToken} from "@/api/login/types";
import qs from "qs";

const API: string = '/auth'

export const getCode = () => {
    return request<Code, Code, any>({
        url: API + '/code/getCode',
        method: 'get',
    })
}

export const login = (form: LoginParam) => {
    return request<AccessToken, AccessToken>({
        url: API + '/user/login',
        method: 'post',
        // 将对象转成(key=value键值对)
        data: qs.stringify(form)
    })
}
